<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

namespace Stone\Core;

/**
 * Description of Config
 *
 * @author Administrator
 */
class Config {
    //put your code here
    static private $_C;
    
    static public function load() {
        $appConfig          =   array();
        $stoneConfig        =   array();
        $appConfigFile      =     ROOT_PATH   .   CONFIG_PATH  . "config.php";
        $stoneConfigFile    =     FRAMEWORK_PATH   .   CONFIG_PATH  . "config.php";    
        
        if(file_exists($appConfigFile))
            $appConfig  = include_once $appConfigFile;
        
        if(file_exists($stoneConfigFile))
            $stoneConfig  = include_once $stoneConfigFile;
        
        self::$_C   =    array_merge($stoneConfig , $appConfig); 
    }
    static public function loadAppConfig() {
        $appConfig          =   array();
        $appConfigFile      =     APP_PATH   .   CONFIG_PATH  . "config.php";
        if(file_exists($appConfigFile))
            $appConfig  = include_once $appConfigFile;
        
        self::$_C   =    array_merge(self::$_C , $appConfig); 
    }
    
    static public function get($name){
        if(!isset(self::$_C[$name]))
            return false;
        return self::$_C[$name];
    }
    
    static public function set($name , $value) {
        self::$_C[$name]    =   $value;
    }
    
}
